﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace WebApiSelfHost.Models
{
    [Table("Employee", Schema = "dbo")]
    public class Employee
    {
        [Column("EmployeeId", Order = 1)]
        [Key]
        public Int32 EmployeeId { get; set; }

        [Column("EmployeeNo", Order = 2)]
        [Required(ErrorMessage = "Required Field.")]
        [Display(Name = "Employee Number")]
        public Int32 EmployeeNo { get; set; }

        [Column("FirstName", Order = 3)]
        [Required(ErrorMessage = "Required Field.")]
        [Display(Name = "First Name")]
        [MaxLength(50), MinLength(1)]
        public string FirstName { get; set; }

        [Column("MiddleName", Order = 4)]
        [Display(Name = "Middle Name")]
        [MaxLength(50)]
        public string MiddleName { get; set; }

        [Column("LastName", Order = 5)]
        [Required(ErrorMessage = "Required Field.")]
        [Display(Name = "Last Name")]
        [MaxLength(50), MinLength(1)]
        public string LastName { get; set; }

        [NotMapped]
        [Display(Name = "Full Name")]
        public string Name { get { return FirstName + " " + MiddleName + " " + LastName; } }

        [Column("UserName", Order = 6)]
        [Required(ErrorMessage = "Required Field.")]
        [Display(Name = "User Name")]
        [StringLength(100)]
        [DataType(DataType.Text)]
        public string UserName { get; set; }

        [Column("DOJ", Order = 7)]
        [Display(Name = "Date of Joining")]
        [DataType(DataType.DateTime)]
        public DateTime? DOJ { get; set; }

        [Column("Email", Order = 8)]
        [Display(Name = "E Mail")]
        [StringLength(200)]
        [DataType(DataType.EmailAddress)]
        public string Email { get; set; }

        [Column("OfficeNo", Order = 9)]
        [Display(Name = "Office Number")]
        [DataType(DataType.PhoneNumber)]
        public Int32 OfficeNo { get; set; }

        [Column("Manager", Order = 10)]
        [Required(ErrorMessage = "Required Field.")]
        public Int32 ManagerId { get; set; }
        public virtual Employee Manager { get; set; }

        [Column("Location", Order = 11)]
        [Required(ErrorMessage = "Required Field.")]
        public Int32 LocationId { get; set; }

        [ForeignKey("LocationId")]
        public virtual Location Location { get; set; }
    }

    [Table("Project", Schema = "dbo")]
    public class Project
    {
        [Column("ProjectId", Order = 1)]
        [Key]
        public Int32 ProjectId { get; set; }

        [Column("Name", Order = 2)]
        [Display(Name = "Project Name")]
        [Required(ErrorMessage = "Required Field.")]
        [StringLength(200)]
        [DataType(DataType.Text)]
        public string Name { get; set; }

        [Column("Description", Order = 3)]
        [Display(Name = "Description")]
        [StringLength(200)]
        [DataType(DataType.Text)]
        public string Description { get; set; }

        [Column("Manager", Order = 4)]
        [Required(ErrorMessage = "Required Field.")]
        [Display(Name = "Manager")]
        public Int32 EmployeeId { get; set; }

        [ForeignKey("EmployeeId")]
        public virtual Employee Manager { get; set; }

        [Column("DOC", Order = 5)]
        [Required(ErrorMessage = "Required Field.")]
        [Display(Name = "Date of Creation")]
        [DataType(DataType.DateTime)]
        public DateTime? DOC { get; set; }

        [Column("DOS", Order = 6)]
        [Display(Name = "Start Date")]
        [DataType(DataType.DateTime)]
        public DateTime? DOS { get; set; }

        [Column("DOE", Order = 7)]
        [Display(Name = "End Date")]
        [DataType(DataType.DateTime)]
        public DateTime? DOE { get; set; }
    }

    [Table("Certificate", Schema = "dbo")]
    public class Certificate
    {
        [Column("CertificateId", Order = 1)]
        [Key]
        public Int32 CertificateId { get; set; }

        [Column("Name", Order = 2)]
        [Required(ErrorMessage = "Required Field.")]
        [Display(Name = "Certificate Name")]
        [StringLength(100)]
        [DataType(DataType.Text)]
        public string Name { get; set; }

        [Column("Discription", Order = 3)]
        [Display(Name = "Discription")]
        [StringLength(200)]
        [DataType(DataType.Text)]
        public string Discription { get; set; }
    }

    [Table("EmployeeCertificate", Schema = "dbo")]
    public class EmployeeCertificate
    {
        [Column("EmployeeCertificateId", Order = 1)]
        [Key]
        public Int32 EmployeeCertificateId { get; set; }

        [Column("Employee", Order = 2)]
        [Required(ErrorMessage = "Required Field.")]
        public Int32 EmployeeId { get; set; }

        [ForeignKey("EmployeeId")]
        public virtual Employee Employee { get; set; }

        [Column("Certificate", Order = 3)]
        [Required(ErrorMessage = "Required Field.")]
        public Int32 CertificateId { get; set; }

        [ForeignKey("CertificateId")]
        public virtual Certificate Certificate { get; set; }

        [Column("DOC", Order = 4)]
        [Display(Name = "Date of Creation")]
        [DataType(DataType.DateTime)]
        public DateTime? DOC { get; set; }

        [Column("Status", Order = 5)]
        [Required(ErrorMessage = "Required Field.")]
        public Int32 StatusId { get; set; }

        [ForeignKey("StatusId")]
        public virtual Status Status { get; set; }
    }

    [Table("EmployeeSkill", Schema = "dbo")]
    public class EmployeeSkill
    {
        [Column("EmployeeSkillId", Order = 1)]
        [Key]
        public Int32 EmployeeSkillId { get; set; }

        [Column("Employee", Order = 2)]
        [Required(ErrorMessage = "Required Field.")]
        public Int32 EmployeeId { get; set; }

        [ForeignKey("EmployeeId")]
        public virtual Employee Employee { get; set; }

        [Column("Skill", Order = 3)]
        [Required(ErrorMessage = "Required Field.")]
        public Int32 SkillId { get; set; }

        [ForeignKey("SkillId")]
        public virtual Skill Skill { get; set; }

        [Column("Level", Order = 4)]
        [Required(ErrorMessage = "Required Field.")]
        public Int32 LevelId { get; set; }

        [ForeignKey("LevelId")]
        public virtual Level Level { get; set; }

        [Column("DOC", Order = 5)]
        [Display(Name = "Date of Creation")]
        [DataType(DataType.DateTime)]
        public DateTime? DOC { get; set; }

        [Column("Status", Order = 6)]
        [Required(ErrorMessage = "Required Field.")]
        public Int32 StatusId { get; set; }

        [ForeignKey("StatusId")]
        public virtual Status Status { get; set; }
    }

    [Table("EmployeeRole", Schema = "dbo")]
    public class EmployeeRole
    {
        [Column("EmployeeRoleId", Order = 1)]
        public Int32 EmployeeRoleId { get; set; }

        [Column("Employee", Order = 2)]
        [Required(ErrorMessage = "Required Field.")]
        public Int32 EmployeeId { get; set; }

        [ForeignKey("EmployeeId")]
        public virtual Employee Employee { get; set; }

        [Column("Role", Order = 3)]
        [Required(ErrorMessage = "Required Field.")]
        public Int32 RoleId { get; set; }

        [ForeignKey("RoleId")]
        public virtual Role Role { get; set; }

        [Column("DOC", Order = 4)]
        [Display(Name = "Date of Creation")]
        [DataType(DataType.DateTime)]
        public DateTime? DOC { get; set; }

        [Column("Status", Order = 5)]
        [Required(ErrorMessage = "Required Field.")]
        public Int32 StatusId { get; set; }

        [ForeignKey("StatusId")]
        public virtual Status Status { get; set; }
    }

    [Table("Level", Schema = "dbo")]
    public class Level
    {
        [Column("LevelId", Order = 1)]
        [Key]
        public Int32 LevelId { get; set; }

        [Column("Name", Order = 2)]
        [Required(ErrorMessage = "Required Field.")]
        [Display(Name = "Level")]
        [StringLength(20)]
        [DataType(DataType.Text)]
        public string Name { get; set; }

        [Column("Discription", Order = 3)]
        [Display(Name = "Discription")]
        [StringLength(200)]
        [DataType(DataType.Text)]
        public string Discription { get; set; }
    }

    [Table("Location", Schema = "dbo")]
    public class Location
    {
        [Column("LocationId", Order = 1)]
        [Key]
        public Int32 LocationId { get; set; }

        [Column("Name", Order = 2)]
        [Required(ErrorMessage = "Required Field.")]
        [Display(Name = "Location")]
        [StringLength(50)]
        [DataType(DataType.Text)]
        public string Name { get; set; }

        [Column("Discription", Order = 3)]
        [Display(Name = "Discription")]
        [StringLength(200)]
        [DataType(DataType.Text)]
        public string Discription { get; set; }
    }

    [Table("Log", Schema = "dbo")]
    public class Log
    {
        [Column("LogId", Order = 1)]
        [Key]
        [Display(Name = "Sr.No.")]
        public Int32 LogId { get; set; }

        [Column("User", Order = 2)]
        [Display(Name = "User")]
        [StringLength(200)]
        [DataType(DataType.Text)]
        public string User { get; set; }

        [Column("Controller", Order = 3)]
        [Display(Name = "Controller")]
        [StringLength(200)]
        [DataType(DataType.Text)]
        public string Controller { get; set; }

        [Column("Action", Order = 4)]
        [Display(Name = "Action")]
        [StringLength(200)]
        [DataType(DataType.Text)]
        public string Action { get; set; }

        [Column("Ip", Order = 5)]
        [Display(Name = "System IP")]
        [StringLength(200)]
        [DataType(DataType.Text)]
        public string Ip { get; set; }

        [Column("Datetime", Order = 6)]
        [Display(Name = "Date/Time")]
        [DataType(DataType.DateTime)]
        public DateTime Datetime { get; set; }
    }

    [Table("Notification", Schema = "dbo")]
    public class Notification
    {
        [Column("NotificationId", Order = 1)]
        [Key]
        public Int32 NotificationId { get; set; }

        [Column("Type", Order = 2)]
        [Display(Name = "Type of Notification")]
        [MaxLength(10)]
        public string Type { get; set; }

        [Column("From", Order = 3)]
        [Display(Name = "From User Name")]
        [MaxLength(50)]
        public string From { get; set; }

        [Column("To", Order = 4)]
        [Display(Name = "To Manager Name")]
        [MaxLength(50)]
        public string To { get; set; }

        [Column("Description", Order = 5)]
        [Display(Name = "Notification")]
        [MaxLength(100)]
        public string Description { get; set; }

        [Column("DOC", Order = 6)]
        [Display(Name = "Date of Creation")]
        [DataType(DataType.DateTime)]
        public DateTime DOC { get; set; }
    }

    [Table("ProjectEmployee")]
    public class ProjectEmployee
    {
        [Column("ProjectEmployeeId", Order = 1)]
        [Key]
        public Int32 ProjectEmployeeId { get; set; }

        [Column("Project", Order = 2)]
        [Required(ErrorMessage = "Required Field.")]
        public Int32 ProjectId { get; set; }

        [ForeignKey("ProjectId")]
        public virtual Project Project { get; set; }

        [Column("Employee", Order = 3)]
        [Required(ErrorMessage = "Required Field.")]
        public Int32 EmployeeId { get; set; }

        [ForeignKey("EmployeeId")]
        public virtual Employee Employee { get; set; }

        [Column("DOA", Order = 4)]
        [Display(Name = "Date of Allocation")]
        [DataType(DataType.DateTime)]
        public DateTime? DOA { get; set; }

        [Column("DOR", Order = 5)]
        [Display(Name = "Date of Release")]
        [DataType(DataType.DateTime)]
        public DateTime? DOR { get; set; }
    }

    [Table("ProjectForcast", Schema = "dbo")]
    public class ProjectForcast
    {
        [Column("ProjectForcastId", Order = 1)]
        [Key]
        public Int32 ProjectForcastId { get; set; }

        [Column("Project", Order = 2)]
        [Required(ErrorMessage = "Required Field.")]
        public Int32 ProjectId { get; set; }

        [ForeignKey("ProjectId")]
        public virtual Project Project { get; set; }

        [Column("Requirement", Order = 3)]
        [Required(ErrorMessage = "Required Field.")]
        [Display(Name = "Requirement")]
        public Int32 Requirement { get; set; }

        [Column("DOR", Order = 4)]
        [Required(ErrorMessage = "Required Field.")]
        [Display(Name = "Required By")]
        [DataType(DataType.DateTime)]
        public DateTime? DOR { get; set; }
    }

    [Table("ProjectSkill", Schema = "dbo")]
    public class ProjectSkill
    {
        [Column("ProjectSkillId", Order = 1)]
        [Key]
        public Int32 ProjectSkillId { get; set; }

        [Column("Project", Order = 2)]
        [Required(ErrorMessage = "Required Field.")]
        public Int32 ProjectId { get; set; }

        [ForeignKey("ProjectId")]
        public virtual Project Project { get; set; }

        [Column("Skill", Order = 3)]
        [Required(ErrorMessage = "Required Field.")]
        public Int32 SkillId { get; set; }

        [ForeignKey("SkillId")]
        public virtual Skill Skill { get; set; }

        [Column("Level", Order = 4)]
        [Required(ErrorMessage = "Required Field.")]
        public Int32 LevelId { get; set; }

        [ForeignKey("LevelId")]
        public virtual Level Level { get; set; }
    }

    [Table("Role", Schema = "dbo")]
    public class Role
    {
        [Column("RoleId", Order = 1)]
        [Key]
        public Int32 RoleId { get; set; }

        [Column("Name", Order = 2)]
        [Required(ErrorMessage = "Required Field.")]
        [Display(Name = "Role")]
        [StringLength(20)]
        [DataType(DataType.Text)]
        public string Name { get; set; }

        [Column("Discription", Order = 3)]
        [Display(Name = "Discription")]
        [StringLength(200)]
        [DataType(DataType.Text)]
        public string Discription { get; set; }
    }

    [Table("Skill", Schema = "dbo")]
    public class Skill
    {
        [Column("SkillId", Order = 1)]
        [Key]
        public Int32 SkillId { get; set; }

        [Column("Name", Order = 2)]
        [Required(ErrorMessage = "Required Field.")]
        [Display(Name = "Skill")]
        [StringLength(50)]
        [DataType(DataType.Text)]
        public string Name { get; set; }

        [Column("Discription", Order = 3)]
        [Display(Name = "Discription")]
        [StringLength(200)]
        [DataType(DataType.Text)]
        public string Discription { get; set; }
    }

    [Table("Status", Schema = "dbo")]
    public class Status
    {
        [Column("StatusId", Order = 1)]
        public Int32 StatusId { get; set; }

        [Column("Name", Order = 2)]
        [Required(ErrorMessage = "Required Field.")]
        [Display(Name = "Status")]
        [StringLength(20)]
        [DataType(DataType.Text)]
        public string Name { get; set; }

        [Column("Discription", Order = 3)]
        [Display(Name = "Discription")]
        [StringLength(200)]
        [DataType(DataType.Text)]
        public string Discription { get; set; }
    }
}
